<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<title>模块中心</title>
<head th:replace="common/incHead :: incHead"></head>
<body class="ok-body-scroll console">
<div class="ok-body home">
    <div class="layui-row ">
        <div class="layui-col-md3">
            <div class="layui-card" layoutH="25">
                <div class="layui-card-header">
                    <div class="ok-card-title">系统信息</div>
                </div>
                <div class="ok-card-body">
                    <ul class="folder-list" style="padding: 0">
                        <li class="p-xxs" th:each="item:${systems}">
                            <a href="javascript:" th:if="${sysSystem.id} == ${item.id}"><i class="layui-icon layui-icon-link"></i>
                                <selection class="text-info">[[${item.systemSort}]]:[[${item.systemName}]]【[[${item.systemCode}]]】</selection>
                            </a>
                            <a th:href="@{/sys/model(systemId=${item.id})}" th:if="${sysSystem.id} != ${item.id}"><i class="layui-icon layui-icon-link"></i>
                                <selection class="">[[${item.systemSort}]]:[[${item.systemName}]]【[[${item.systemCode}]]】</selection>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="layui-col-md9 p-l-sm">
            <div class="layui-card">
                <div class="layui-card-header">
                    <div class="ok-card-title">
                        <div class="layui-btn-container p-t-xxs">
                            <button class="layui-btn layui-btn-sm layui-btn-warm" th:ljUrl="|/sys/model/add?systemId=${sysSystem.id}|" th:title="|添加系统模块:${sysSystem.id}|" ljWidth="600px" ljHeight="400px" target="ljOpenSubmit"><i class="layui-icon layui-icon-add-circle"></i>添加模块
                            </button>
                            <button class="layui-btn layui-btn-sm layui-btn-normal pull-right btnPageRefresh" lay-event="reload"><i class="layui-icon layui-icon-search"></i>刷新页面</button>
                        </div>
                    </div>
                </div>
                <div class="ok-card-body">
                    <div class="layui-row ljLayTableBox">
                        <table class="layui-hide" id="indexTable" lay-filter="indexTable"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:replace="common/incBottom :: incBottom"></div>
<script th:inline="javascript">
    /*<![CDATA[*/
    var indexData = [];
    /*[# th:each="item,itemStat:${sysModels}"]*/
    indexData.push({
        id: [[${item.id}]],
        modelCode: [[${item.modelCode}]],
        modelSort: [[${item.modelSort}]],
        modelName: [[${item.modelName}]],
        modelStyle: [[${item.modelStyle}]],
        modelDesc: [[${item.modelDesc}]],
        dataStatus: [[${item.dataStatus}]],
        createTime: [[${@lj.date(item.createTime)}]]
    });
    /*[/]*/
    /*]]>*/
</script>
<script th:inline="none">
    layui.use(["element", "jquery", "table", "okLayer", "okPapper"], function () {
        let table = layui.table;
        let okPapper = layui.okPapper;
        let $ = layui.jquery;
        okLoading.close($);
        table.render({
            elem: '#indexTable',
            data: indexData,
            height: 'full-98',
            page: false,
            limit: indexData.length,
            toolbar: false,
            size: "sm",
            cols: [[
                {field: "id", title: "模块ID", fixed: "left", width: 100, sort: true},
                {field: "modelCode", title: "模块编号", fixed: "left", width: 100},
                {field: "modelName", title: "模块名称", width: 100},
                {field: "modelSort", title: "模块排序", width: 100},
                {field: "modelStyle", title: "模块样式", minWidth: 100},
                {field: "modelDesc", title: "模块备注", minWidth: 100},
                {field: "dataStatus", title: "数据状态", width: 90, align: 'center', templet: "#DataStatusTpl"},
                {field: "createTime", title: "添加时间", width: 150},
                {title: "操作", width: 150, align: "center", fixed: "right", templet: "#operationTpl"}
            ]],
            done: function (res, curr, count) {
            }
        });
        table.on('sort(indexTable)', function (obj) {
            $("input[name='orderField']").val(obj.field);
            $("input[name='orderDirection']").val(obj.type);
            $("#pagerForm").submit();
        });
        okPapper.init();
    })
</script>
<!-- 默认统一操作模板 -->
<script type="text/html" id="operationTpl">
    <button th:if="${@lj.limit('SysModelEdit') gt 0}" class="layui-btn layui-btn-xs" title="模块中心编辑:{{d.id}}" ljUrl="/sys/model/edit?id={{d.id}}" ljWidth="600px" ljHeight="400px" target="ljOpenSubmit">
        <i class="layui-icon layui-icon-edit"></i>编辑
    </button>
    <button th:if="${@lj.limit('SysModelDel') gt 0}" class="layui-btn layui-btn-xs layui-btn-danger" title="确认要删除该模块中心吗?" ljUrl="/sys/model/del?id={{d.id}}" target="ljAjaxTodo">
        <i class="layui-icon layui-icon-delete"></i>删除
    </button>
</script>
<!-- DataStatus枚举模板 -->
<script type="text/html" id="DataStatusTpl" th:inline="none">
    {{#  if(d.dataStatus == 0){ }}
    <span class="layui-btn layui-btn-normal layui-btn-xs" ljUrl="/sys/model/status?id={{d.id}}&status=1" title="确认停用么?" target="ljAjaxTodo">已启用</span>{{#  } else if(d.dataStatus == 1) { }}
    <span class="layui-btn layui-btn-danger layui-btn-xs" ljUrl="/sys/model/status?id={{d.id}}&status=0" title="是否重新启动?" target="ljAjaxTodo">已停用</span>{{#  } else if(d.dataStatus == 2) { }}
    <span class="layui-btn layui-btn-warm layui-btn-xs" ljUrl="/sys/model/status?id={{d.id}}&status=0" title="是否重新启动?">已保留</span>{{#  } }}
</script>
</body>
</html>